import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { size } from '@/config';
const { px } = size;

export interface ListItemProps {
  title: string;
  right?: React.ReactElement;
}
export const ListItem: React.FC<ListItemProps> = props => {
  const { title, right } = props;
  return (
    <View style={styles.rowWrap}>
      <Text style={styles.title}>{title}</Text>
      <View>{right}</View>
    </View>
  );
};

export default ListItem;

const styles = StyleSheet.create({
  rowWrap: {
    height: px(44),
    lineHeight: px(44),
    marginHorizontal: px(16),
    borderBottomWidth: 1,
    borderBottomColor: '#ccc',
    display: 'flex',
    flexDirection: 'row',
    justifyContent: 'space-between',
  },
  title: {
    lineHeight: px(44),
    fontSize: px(18),
    fontWeight: '600',
    color: '#333333',
  },
});
